    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>layui</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link rel="stylesheet" href="/static/admin/lib/layui-v2.5.5/css/layui.css" media="all">
        <link rel="stylesheet" href="/static/admin/css/public.css" media="all">
    </head>
    <body>
    <div class="layuimini-container">
        <div class="layuimini-main">

            <fieldset class="table-search-fieldset">
                <legend>搜索信息货主</legend>
                <div style="margin: 10px 10px 10px 10px">
                    <form class="layui-form layui-form-pane" action="">
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">用户姓名</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="username" autocomplete="off" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-inline">
                                <button type="submit" class="layui-btn layui-btn-primary"  lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
                            </div>
                        </div>
                    </form>
                </div>
            </fieldset>

            <script type="text/html" id="toolbarDemo">
                <div class="layui-btn-container">
                    <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add"> 添加 </button>
                    <button class="layui-btn layui-btn-sm layui-btn-danger data-delete-btn" lay-event="delete"> 删除 </button>
                </div>
            </script>

            <table class="layui-hide" id="currentTableId" lay-filter="employeeTableFilter"></table>

            <script type="text/html" id="currentTableBar">
                <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
                <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
            </script>

        </div>
    </div>
    <script src="/static/admin/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
    <script>
        layui.use(['form', 'table','jquery'], function () {
            var $ = layui.jquery,
                form = layui.form,
                table = layui.table,
                $ = layui.jquery;

            table.render({
                elem: '#currentTableId',
                url: '/admin/report/queryAllCityOwnerdto',
                toolbar: '#toolbarDemo',
                defaultToolbar: ['filter', 'exports', 'print', {
                    title: '提示',
                    layEvent: 'LAYTABLE_TIPS',
                    icon: 'layui-icon-tips'
                }],
                cols: [
                    [
                        {type: "checkbox", width: 50}
                        ,
                        {field: 'id', width: 90, title: 'ID', sort: true},

                        {field: 'user_name', width: 110, title: '用户名'},

                        {field: 'password', width: 110, title: '密码'},

                        {field: 'phone', width: 110, title: '电话'},

                        {field: 'regTime', width: 110, title: '注册日期'},

                        {field: 'sex', width: 110, title: '性别', sort: true},



                        {field: 'integral', width: 110, title: '积分', sort: true},


                        {field: 'customer_money', width: 135, title: '余额', sort: true},

                        {title: '操作', minWidth: 150, toolbar: '#currentTableBar', align: "center"}
                    ]
                ],
                limits: [10, 15, 20, 25, 50, 100],
                limit: 15,
                page: true,
                skin: 'line'
            });

            // 监听搜索操作
            form.on('submit(data-search-btn)', function (data) {
                var result = JSON.stringify(data.field);
                layer.alert(result, {
                    title: '最终的搜索信息'
                });

                //执行搜索重载
                table.reload('currentTableId', {
                    page: {
                        curr: 1
                    }
                    , where: {
                        searchParams: result
                    }
                }, 'data');

                return false;
            });
    /**2345666666666666666666666666666666666666666666666666666666666666666*/
            /**
             * toolbar监听事件
             */
            table.on('toolbar(employeeTableFilter)', function (obj) {
                if (obj.event === 'add') {  // 监听添加操作
                    var sue = layer.open({
                        type: 1,
                        area: ['100%', '100%'],
                        content: $("#sue")
                    });
                    form.on('submit(saveBtn)', function (data) {

                        console.log(data.field);
                        $.ajax({
                            url:"/admin/report/addOwner",
                            type:"post",
                            data:
                              data.field
                            ,
                            dataType:"text",
                            success:function(data){
                                table.reload('currentTableId', {
                                    url:"/admin/report/queryAllCityOwnerdto",
                                    type:"post"
                                });
                                layer.close(sue);
                                $("#user_name").val("");
                                $("#password").val("");
                                $("#phone").val("");
                                $("#regTime").val("");
                                $("#sex").val("");
                                $("#integral").val("");
                                $("#customer_money").val("");
                            }
                        });
                        return false;
                    });
                } else if (obj.event === 'delete') {  // 监听删除操作
                    var checkStatus = table.checkStatus('currentTableId')
                        , data = checkStatus.data;
                    layer.alert(JSON.stringify(data));
                }
            });

            //监听表格复选框选择
            table.on('checkbox(employeeTableFilter)', function (obj) {
                console.log(obj)
            });

            table.on('tool(employeeTableFilter)', function (obj) {
                var data = obj.data;
                console.log(data);
                if (obj.event === 'edit') {
                    var index = layer.open({
                        title: '编辑用户',
                        type: 1,
                        area: ['100%', '100%'],
                        content:  $("#sue"),
                        success:function () {
                            $("#id").val(data.id);
                            $("#user_name").val(data.user_name);
                            $("#password").val(data.password);
                            $("#phone").val(data.phone);
                            $("#regTime").val(data.regTime);
                            $("#sex").val(data.sex);
                            $("#integral").val(data.integral);
                            $("#customer_money").val(data.customer_money);
                        }
                    });

                   $('#saveBtns').click(function () {
                       $.ajax({
                           url:"/admin/report/updateOwner",
                           type:"post",
                           data: {
                               id: $("#id").val(),
                               user_name: $("#user_name").val(),
                               password: $("#password").val(),
                               phone: $("#phone").val(),
                               regTime: $("#regTime").val(),
                               sex: $("#sex").val(),
                               integral: $("#integral").val(),
                               customer_money: $("#customer_money").val()
                           },
                           dataType:"text",
                           success:function(data){
                               table.reload('currentTableId', {
                                   url:"/admin/report/queryAllCityOwnerdto",
                                   type:"post"
                               });
                               layer.close(index);
                           }
                       });
                   });
                    return false;
                } else if (obj.event === 'delete') {
                    layer.confirm('真的删除行么', function (index) {
                        $.ajax({
                            url:"/admin/return/deleteowner",
                            type:"POST",
                            data:{
                                id:data.id
                            },
                            dataType:"text",
                            success:function(data){
                                table.reload('currentTableId', {
                                    url:"/admin/report/queryAllCityOwnerdto",
                                    type:"post"
                                });

                            }
                        });
                        obj.del();
                        layer.close(index);
                    });
                }
            });

            layui.use('laydate', function(){
                var laydate = layui.laydate;

                //执行一个laydate实例,日期格式
                laydate.render({
                    elem: '#regTime' //指定元素
                });
            });
        });
    </script>
    <div style="display:none" id="sue">
        <div class="layui-form layuimini-form">
            <input type="hidden" name="id" id="id"></input>
            <div class="layui-form-item">
                <label class="layui-form-label required">货主姓名:</label>
                <div class="layui-input-block" style="width: 200px;">
                    <input type="text" id="user_name" name="user_name"  value=" " class="layui-input">
                </div>
            </div>
                <div class="layui-form-item">
                    <label class="layui-form-label required">密码:</label>
                    <div class="layui-input-block" style="width: 200px;">
                        <input type="text" id="password" name="password"  value=" " class="layui-input">
                    </div>
                </div>


                    <div class="layui-form-item">
                        <label class="layui-form-label required">电话：</label>
                        <div class="layui-input-block" style="width: 200px;">
                            <input type="text" id="phone" name="phone"  value=" " class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label required">注册日期:</label>
                        <div class="layui-inline">
                            <input type="text" class="layui-input" id="regTime" name="regTime">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">性别:</label>
                        <div class="layui-input-inline" style="width: 200px;"  >
                            <select name="sex" lay-filter="aihao" id="sex" >
                                <option value=" ">请选择</option>
                                <option value="男">男</option>
                                <option value="女">女</option>
                            </select>
                        </div>
                    </div>


                        <div class="layui-form-item">
                            <label class="layui-form-label required">积分:</label>
                            <div class="layui-input-block" style="width: 200px;">
                                <input type="text" id="integral" name="integral"  value=" " class="layui-input">
                            </div>
                        </div>


                       <div class="layui-form-item">
                           <label class="layui-form-label required">余额:</label>
                        <div class="layui-input-block" style="width: 200px;">
                            <input type="text" id="customer_money" name="customer_money"  value=" " class="layui-input">
                        </div>
                     </div>



            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认新增</button>
                    <button type="button" class="layui-btn layui-btn-normal" id="saveBtns">确认修改</button>
                </div>

                <!--<div class="layui-input-block">-->
                <!--<button type="button" class="layui-btn layui-btn-normal" id="saveBtns">原始按钮</button>-->
                <!--</div>-->
            </div>
        </div>
    </div>

    </body>
</html>
